/**   
 * @Title: LotteryInfoListAgp.java 
 * @Package com.esun.rabbit2.viewer.mainact.lotteryinfoact 
 * @Description: (开奖信息ActivityGroup  承载ListviewActivity) 
 * @Author Billy qigs@500wan.com   
 * @Date 2011-6-20 上午10:34:08  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.viewer.mainact.lotteryinfoact;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Hashtable;

import android.app.ActivityGroup;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.animation.AnticipateOvershootInterpolator;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TabHost;

import android.widget.TextView;
import android.widget.Toast;

import com.esun.config.Config;
import com.esun.config.Key;
import com.esun.config.Language;
import com.esun.model.CurrentLotteryNumInfo;
import com.esun.model.ExpectListInfo;
import com.esun.model.ServerCurrentTimeInfo;
import com.esun.network.ConnectionChangeReceiver;
import com.esun.rabbit2.communicaters.lotteryinfo.GetServerTimeCommunicater;
import com.esun.ui.R;
import com.esun.util.ViewerUtil;
import com.esun.util.log.EDebug;
import com.esun.util.wheel.widget.NumericWheelAdapter;
import com.esun.util.wheel.widget.OnWheelChangedListener;
import com.esun.util.wheel.widget.OnWheelScrollListener;
import com.esun.util.wheel.widget.WheelView;

/**
 * @ClassName: LotteryInfoListAgp
 * @Description: (ActivityGroup承载开奖信息列表Activity)
 * @author Billy qigs@500wan.com
 * @date 2011-6-20 上午10:34:08
 * 
 */
public class LotteryInfoListAgp extends ActivityGroup implements OnClickListener {
	public TabHost lotteryInfoListTabHost;
	private ImageButton btnBack;// 返回按钮
	private ImageButton btnDate;// 时间选择按钮
	private Button btnExpect;// 期号选择
	private TextView tvTitle;// 标题文字
	private Handler handler;
	private GetServerTimeCommunicater timeCommunicater;
	private String strCategory;

	/********** 1.6.0kael添加、修改为ActivityGroup **************************/
	/** 承载最新详情和更多期次的按钮的LinearLayout */
	private LinearLayout lltitle;
	/** 最新详情按钮 */
	private LinearLayout lllatestdetails;
	/** 更多期次按钮 */
	private LinearLayout llmoretime;
	/** 最新详情图标 */
	private ImageView ivlatestdetails;
	/** 最新详情字样 */
	private TextView tvlatestdetails;
	/** 更多其次图标 */
	private ImageView ivmoretime;
	/** 更多期次字样 */
	private TextView tvmoretime;
	/** 动态加载Activity的FrameLayout */
	private FrameLayout container;

	/************************************************/

	private final String LOTTERY_ID = "lotid";
	private final String TITLE_SHUANGSEQIU = "双色球开奖信息";
	private final String TITLE_DALETOU = "大乐透开奖信息";
	private final String TITLE_SHIYIXUANWU = "11选5开奖信息";
	private final String TITLE_FOOTBALL = "竞彩足球开奖信息";
	private final String TITLE_FUCAISANDI = "福彩3D开奖信息";
	private final String TITLE_BEIDAN = "北单胜平负开奖信息";
	private final String TITLE_SHENGFUCAI = "足球胜负/任九开奖信息";
	private final String TITLE_RENXUANJIU = "足球胜负/任九开奖信息";
	private final String MSG_EXPCTGETFAILED = "期号获取失败";
	// private static final int CURRENT_TABSPEC = 0;
	private static final int DATE_DIALOG_ID = 1;
	private final String TITLE_JINGCAILANQIU = "竞彩篮球开奖信息";

	private boolean isStop = false;// 若获取失败，是否继续获取当前时间

	private int mYear = 0;
	private int mMonth = 0;
	private int mDay = 0;
	private int currentYear = 0;
	private int currentMonth = 0;
	private int currentDay = 0;
	private Bundle bundle;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 隐藏标题栏
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.lotteryinfolist_agp);
		EDebug.o(this, "start");
		initHandler();
		initUI();

	}

	// 初始化
	public void initUI() {

		tvTitle = (TextView) findViewById(R.id.lotteryinfolist_agp_tv_title);

		btnBack = (ImageButton) findViewById(R.id.lotteryinfolist_agp_btn_back);
		btnBack.setOnClickListener(this);
		btnDate = (ImageButton) findViewById(R.id.lotteryinfolist_agp_btn_dateChoose);
		btnDate.setOnClickListener(this);
		btnExpect = (Button) findViewById(R.id.lotteryinfolist_agp_btn_expectChoose);
		btnExpect.setOnClickListener(this);
		lltitle = (LinearLayout) findViewById(R.id.lotteryinfolist_agp_webview_ll_title);
		lllatestdetails = (LinearLayout) findViewById(R.id.lotteryinfolist_agp_ll_latestdetails);
		lllatestdetails.setOnClickListener(this);
		llmoretime = (LinearLayout) findViewById(R.id.lotteryinfolist_agp_ll_moretime);
		llmoretime.setOnClickListener(this);
		ivlatestdetails = (ImageView) findViewById(R.id.lotteryinfolist_agp_iv_latestdetails);
		ivmoretime = (ImageView) findViewById(R.id.lotteryinfolist_agp_iv_moretime);
		tvlatestdetails = (TextView) findViewById(R.id.lotteryinfolist_agp_tv_latestdetails);
		tvmoretime = (TextView) findViewById(R.id.lotteryinfolist_agp_tv_moretime);
		container = (FrameLayout) findViewById(R.id.lotteryinfolist_agp_containerBody);
		// 判断彩种
		bundle = this.getIntent().getExtras();
		strCategory = bundle.getString(LOTTERY_ID);

		if (strCategory.equals(Config.SHUANGSEQIU)) {
			tvTitle.setText(TITLE_SHUANGSEQIU);
			lltitle.setVisibility(View.VISIBLE);
			bundle.putString(Key.KEY_TYPE, "2");
		} else if (strCategory.equals(Config.DALETOU)) {
			tvTitle.setText(TITLE_DALETOU);
			lltitle.setVisibility(View.VISIBLE);
			bundle.putString(Key.KEY_TYPE, "1");
		} else if (strCategory.equals(Config.SHIYIXUANWU)) {
			tvTitle.setText(TITLE_SHIYIXUANWU);
			lltitle.setVisibility(View.VISIBLE);
			bundle.putString(Key.KEY_TYPE, "4");
		} else if (strCategory.equals(Config.JINGCAIZUQIU)) {
			tvTitle.setText(TITLE_FOOTBALL);
			lltitle.setVisibility(View.GONE);
		} else if (strCategory.equals(Config.FUCAI3D)) {
			tvTitle.setText(TITLE_FUCAISANDI);
			lltitle.setVisibility(View.VISIBLE);
			bundle.putString(Key.KEY_TYPE, "3");
		} else if (strCategory.equals(Config.BEIJINGZUQIUDANCHANG)) {
			tvTitle.setText(TITLE_BEIDAN);
			lltitle.setVisibility(View.GONE);
		} else if (strCategory.equals(Config.SHENGFUCAI)) {
			tvTitle.setText(TITLE_SHENGFUCAI);
			lltitle.setVisibility(View.GONE);

		} else if (strCategory.equals(Config.RENXUANJIU)) {
			tvTitle.setText(TITLE_RENXUANJIU);
			lltitle.setVisibility(View.GONE);
		} else if (strCategory.equals(Config.JINGCAILANQIU)) {
			tvTitle.setText(TITLE_JINGCAILANQIU);
			lltitle.setVisibility(View.GONE);
		}

		// lotteryInfoListTabHost = (TabHost) findViewById(R.id.lotteryinfolist_agp_tabhost);
		// lotteryInfoListTabHost.setup(LotteryInfoListAgp.this.getLocalActivityManager());
		if (bundle.getBoolean("isfootball")) {

			if (strCategory.equals(Config.BEIJINGZUQIUDANCHANG)) {
				btnExpect.setVisibility(View.VISIBLE);
			} else if (strCategory.equals(Config.JINGCAIZUQIU)) {
				btnDate.setVisibility(View.VISIBLE);
				// 获取当前时间
				getCurrentServerTimeThread();
			} else if (strCategory.equals(Config.JINGCAILANQIU)) {
				btnDate.setVisibility(View.VISIBLE);
				// 获取当前时间
				getCurrentServerTimeThread();
			}
			container.removeAllViews();
			container.addView(getLocalActivityManager().startActivity(Key.KEY_MORETIMEFOOTBALL, new Intent(LotteryInfoListAgp.this, LotteryInfoListFootball.class).putExtras(bundle)).getDecorView());
		} else {
			if (strCategory.equals(Config.SHENGFUCAI) || strCategory.equals(Config.RENXUANJIU)) {
				container.removeAllViews();
				container.addView(getLocalActivityManager().startActivity(Key.KEY_MORETIME, new Intent(LotteryInfoListAgp.this, LotteryInfoListAct.class).putExtras(bundle)).getDecorView());
			} else {
				container.removeAllViews();
				container.addView(getLocalActivityManager().startActivity(Key.KEY_LATESTDETAILS, new Intent(LotteryInfoListAgp.this, LatestdetailsAct.class).putExtras(bundle)).getDecorView());
			}
		}
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.lotteryinfolist_agp_btn_back:
			LotteryInfoListAgp.this.finish();
			break;

		case R.id.lotteryinfolist_agp_btn_dateChoose:
			LotteryInfoListAgp.this.showDialog(DATE_DIALOG_ID);

			break;

		case R.id.lotteryinfolist_agp_btn_expectChoose:
			// 提示期号选择框
			if (LotteryInfoListFootball.isGetExpectSucceed) {
				if (expectChooseDialog == null) {
					showExpectChooseDialog();
				}
				expectChooseDialog.show();
			} else {
				Toast.makeText(LotteryInfoListAgp.this, MSG_EXPCTGETFAILED, Toast.LENGTH_SHORT).show();
			}

			break;

		case R.id.dialog_expect_choose_btn_cancle:

			expectChooseDialog.cancel();

			break;

		case R.id.dialog_expect_choose_btn_submit:

			EDebug.o(this, "点击确定，应该是加载新一期的开奖信息");
			expectChooseDialog.cancel();
			Message msg = LotteryInfoListFootball.handler.obtainMessage(LotteryInfoListFootball.EXPECT_CHANGED, expectSelected);
			LotteryInfoListFootball.handler.sendMessage(msg);

			break;

		case R.id.lotteryinfolist_agp_ll_latestdetails:

			lllatestdetails.setBackgroundResource(R.drawable.anull_icon);
			llmoretime.setBackgroundResource(R.drawable.btn_default_title_right_88x30);
			ivlatestdetails.setImageResource(R.drawable.icon_pressed_this_13x23);
			ivmoretime.setImageResource(R.drawable.icon_default_all_24x24);
			tvlatestdetails.setTextColor(getResources().getColor(R.color.white));
			tvmoretime.setTextColor(getResources().getColor(R.color.lotteryinfodefault));
			container.removeAllViews();
			container.addView(getLocalActivityManager().startActivity(Key.KEY_LATESTDETAILS, new Intent(LotteryInfoListAgp.this, LatestdetailsAct.class).putExtras(bundle)).getDecorView());

			break;

		case R.id.lotteryinfolist_agp_ll_moretime:

			lllatestdetails.setBackgroundResource(R.drawable.btn_default_title_left_88x30);
			llmoretime.setBackgroundResource(R.drawable.anull_icon);
			ivlatestdetails.setImageResource(R.drawable.icon_default_this_13x23);
			ivmoretime.setImageResource(R.drawable.icon_pressed_all_24x24);
			tvlatestdetails.setTextColor(getResources().getColor(R.color.lotteryinfodefault));
			tvmoretime.setTextColor(getResources().getColor(R.color.white));
			container.removeAllViews();
			container.addView(getLocalActivityManager().startActivity(Key.KEY_MORETIME, new Intent(LotteryInfoListAgp.this, LotteryInfoListAct.class).putExtras(bundle)).getDecorView());

			break;

		default:
			break;
		}
	}

	@Override
	protected void onPause() {
		super.onPause();
		isStop = true;
		this.unregisterReceiver(ConnectionChangeReceiver.getConnectionChangeReceiver());
	}

	@Override
	protected void onResume() {
		super.onResume();
		isStop = false;
		this.registerReceiver(ConnectionChangeReceiver.getConnectionChangeReceiver(), ConnectionChangeReceiver.getIntentFilter());
	}

	// 获取本地当前日期
	private void getLocalDate() {
		final Calendar c = Calendar.getInstance();
		updateCurrentTime(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH));
		EDebug.o(this, currentYear + "-" + currentMonth + "-" + currentDay);
	}

	// 更新当前日期
	private void updateCurrentTime(int year, int month, int day) {
		EDebug.o(this, "更新当前日期" + year + "-" + month + "-" + day);
		currentYear = year;
		currentMonth = month;
		currentDay = day;

	}

	CustomDatePicker datePicker;

	@Override
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case DATE_DIALOG_ID:
			EDebug.o(this, "生成dialog" + currentYear + "-" + currentMonth + "-" + currentDay);
			datePicker = new CustomDatePicker(this, mDateSetListener, currentYear, currentMonth - 1, currentDay);
			return datePicker;
		}
		return null;
	}

	@Override
	protected void onPrepareDialog(int id, Dialog dialog) {
		switch (id) {
		case DATE_DIALOG_ID:
			// EDebug.o(this, "print by billy =>> onPrepareDialog 准备dialog current" + currentYear + "-" + currentMonth + "-" + currentDay);
			// EDebug.o(this, "print by billy =>> onPrepareDialog 准备dialog changed" + mYear + "-" + (mMonth + 1) + "-" + mDay);
			// if (mYear == 0 || (mMonth + 1) == 0 || mDay == 0) {
			// EDebug.o(this, "时间出错，初始化" + currentYear + "-" + currentMonth + "-" + currentDay);
			// ((DatePickerDialog) dialog).updateDate(currentYear, currentMonth - 1, currentDay);
			// } else {
			// EDebug.o(this, "更新为上次选择时间" + mYear + "-" + (mMonth + 1) + "-" + mDay);
			// ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay);
			// }
			break;
		}
	}

	// 向竞彩足球开奖信息发送日期
	private void sendDateInfo() {
		EDebug.o(this, mYear + "-" + mMonth + "-" + mDay);
		int temp_month = mMonth + 1;
		if (isDateEnable(mYear, temp_month, mDay)) {
			Message msg;
			Hashtable<String, String> map = new Hashtable<String, String>();
			map.put("year", String.valueOf(mYear));
			map.put(Key.KEY_LOTID, strCategory);
			if (temp_month >= 10) {
				map.put("month", String.valueOf(temp_month));
			} else {
				map.put("month", "0" + String.valueOf(temp_month));
			}
			if (mDay >= 10) {
				map.put("day", String.valueOf(mDay));
			} else {
				map.put("day", "0" + String.valueOf(mDay));
			}
			EDebug.o(this, map.get("year") + "-" + map.get("month") + "-" + map.get("day"));
			msg = LotteryInfoListFootball.handler.obtainMessage(LotteryInfoListFootball.DATE_CHANGED, map);
			LotteryInfoListFootball.handler.sendMessage(msg);
		} else {
			ViewerUtil.showTipDialog(LotteryInfoListAgp.this, getResources().getString(R.string.date_error), false);
		}
	}

	// 判断所选日期是不是超出范围
	private boolean isDateEnable(int year, int month, int day) {

		String[] strStartingDate = Config.FOOTBALL_LOTTERYINFO_STARTINGDATE.split("-");

		int startingYear = Integer.valueOf(strStartingDate[0]);
		int startingMonth = Integer.valueOf(strStartingDate[1]);
		int startingDay = Integer.valueOf(strStartingDate[2]);

		if (year > currentYear || year < startingYear) {
			EDebug.o(this, "所选年份超出范围" + year + "===" + month + "===" + day + "错误");
			return false;
		} else if (year == startingYear) {
			if (month < startingMonth) {
				EDebug.o(this, "所选年份为初始年份时,所选月份小于初始月份" + year + "===" + month + "===" + day + "错误");
				return false;
			} else if (month == startingMonth) {
				if (day < startingDay) {
					EDebug.o(this, "所选年份为初始年份,所选月份为始月份,所选日小于初始日" + year + "===" + month + "===" + day + "错误");
					return false;
				} else {
					EDebug.o(this, "所选年份为初始年份,所选月份为始月份,所选日大于等于初始日" + year + "===" + month + "===" + day + "正确");
					return true;
				}
			} else {
				EDebug.o(this, "所选年份为初始年份,所选月份大于初始月份" + year + "===" + month + "===" + day + "正确");
				return true;
			}
		} else if (year == currentYear) {
			if (month > currentMonth) {
				EDebug.o(this, "所选年份为当前年份,所选月份大于当前月份" + year + "===" + month + "===" + day + "错误");
				return false;
			} else if (month == currentMonth) {
				if (day >= currentDay) {
					EDebug.o(this, "所选年份为当前年份,所选月份等于当前月份,所选日大于等于当前日" + year + "===" + month + "===" + day + "错误");
					return false;
				} else {
					EDebug.o(this, "所选年份为当前年份,所选月份等于当前月份,所选日小于当前日" + year + "===" + month + "===" + day + "正确");
					return true;
				}
			} else {
				EDebug.o(this, "所选年份为当前年份,所选月份小于当前月份" + year + "===" + month + "===" + day + "正确");
				return true;
			}
		} else {
			EDebug.o(this, "所选年份在区间范围内" + year + "===" + month + "===" + day + "正确");
			return true;
		}
	}

	// 点击设置事件响应
	private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {

		public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
			mYear = year;
			mMonth = monthOfYear;
			mDay = dayOfMonth;
			EDebug.o(this, "print by billy =>> onDateSet " + year + "-" + monthOfYear + "-" + dayOfMonth);
			sendDateInfo();
		}
	};

	// 重写DatePickerDialog，改变按钮文字
	private class CustomDatePicker extends DatePickerDialog {

		public CustomDatePicker(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
			super(context, callBack, year, monthOfYear, dayOfMonth);
			setButton("确定", this);
			setButton2("取消", (OnClickListener) null);
		}

		@Override
		public void onDateChanged(DatePicker view, int year, int month, int day) {
			super.onDateChanged(view, year, month, day);
			mYear = year;
			mMonth = month;
			mDay = day;
			EDebug.o(this, "print by billy =>> onDateChanged " + year + "-" + (month + 1) + "-" + day);
		}

	}

	private static final int GET_SERVERTIME_SUCCEED = 10001;
	private static final int GET_SERVERTIME_FAILED = 10002;

	private void initHandler() {
		handler = new Handler() {

			@Override
			public void handleMessage(Message msg) {
				super.handleMessage(msg);
				switch (msg.what) {
				case GET_SERVERTIME_SUCCEED:

					EDebug.o(LotteryInfoListAgp.this, "get time succeed");
					ServerCurrentTimeInfo timeInfo = timeCommunicater.getCurrentServerTime();
					String[] strDate = timeInfo.getServerDate().split("-");
					updateCurrentTime(Integer.valueOf(strDate[0]), Integer.valueOf(strDate[1]), Integer.valueOf(strDate[2]));
					isStop = false;

					break;

				case GET_SERVERTIME_FAILED:

					// 暂用本地时间,3秒后重新获取服务器时间
					EDebug.o(LotteryInfoListAgp.this, "get time succeed failed == delay");
					getLocalDate();
					delayThread();

					break;

				case DELAY_FINISH:

					EDebug.o(LotteryInfoListAgp.this, "get time again");
					if (isStop) {
						getCurrentServerTimeThread();
					}

					break;

				default:
					break;
				}
			}
		};
	}

	// 获取当前服务器时间
	private void getCurrentServerTimeThread() {
		new Thread() {

			@Override
			public void run() {
				super.run();
				timeCommunicater = new GetServerTimeCommunicater();
				try {
					boolean isSucceed = timeCommunicater.isGetServerTimeSucceed();
					if (isSucceed) {
						Message msg = handler.obtainMessage(GET_SERVERTIME_SUCCEED, null);
						handler.sendMessage(msg);
					} else {
						Message msg = handler.obtainMessage(GET_SERVERTIME_FAILED, null);
						handler.sendMessage(msg);
					}
				} catch (Exception e) {
					Message msg = handler.obtainMessage(Config.CONNECTION_FAIL, null);
					handler.sendMessage(msg);
				}
			}
		}.start();
	}

	// 延迟3秒线程
	private static final int DELAY_FINISH = 10003;

	private void delayThread() {
		new Thread() {
			@Override
			public void run() {
				super.run();
				try {
					sleep(3000);
					EDebug.o(LotteryInfoListAgp.this, "delay 3");
					Message msg = new Message();
					msg = handler.obtainMessage(DELAY_FINISH, null);
					handler.sendMessage(msg);
				} catch (Exception e) {

				}
			}
		}.start();
	}

	// 被选中的期号
	private String expectSelected = "";
	private Dialog expectChooseDialog;
	private WheelView mWheelView;

	private void showExpectChooseDialog() {
		expectChooseDialog = new Dialog(LotteryInfoListAgp.this, R.style.dialog);
		expectChooseDialog.getWindow().setContentView(R.layout.dialog_expect_choose);

		Button btnSubmit = new Button(LotteryInfoListAgp.this);
		btnSubmit = (Button) expectChooseDialog.findViewById(R.id.dialog_expect_choose_btn_submit);
		btnSubmit.setOnClickListener(this);
		Button btnCancle = new Button(LotteryInfoListAgp.this);
		btnCancle = (Button) expectChooseDialog.findViewById(R.id.dialog_expect_choose_btn_cancle);
		btnCancle.setOnClickListener(this);

		final ArrayList<Hashtable<String, String>> expectList = new ArrayList<Hashtable<String, String>>();
		// Hashtable<String, String> mapTop = new Hashtable<String, String>();
		// mapTop.put("expect", "开始");
		// expectList.add(mapTop);
		for (int i = 1; i < ExpectListInfo.getExpectListInfo().getExpectList().size(); i++) {
			Hashtable<String, String> map = new Hashtable<String, String>();
			map.put("expect", ExpectListInfo.getExpectListInfo().getExpectList().get(i));
			expectList.add(map);
		}
		// Hashtable<String, String> mapBottom = new Hashtable<String, String>();
		// mapBottom.put("expect", "结束");
		// expectList.add(mapBottom);
		expectSelected = ExpectListInfo.getExpectListInfo().getExpectList().get(1);
		mWheelView = (WheelView) expectChooseDialog.findViewById(R.id.dialog_expect_choose_wheel_expect);
		mWheelView.setAdapter(new NumericWheelAdapter(ExpectListInfo.getExpectListInfo().getExpectList()));
		mWheelView.setCurrentItem(0);
		mWheelView.addChangingListener(changedListener);
		mWheelView.addScrollingListener(scrolledListener);
		mWheelView.setCyclic(true);
		mWheelView.setVisibleItems(5);
		mWheelView.setInterpolator(new AnticipateOvershootInterpolator());

	}

	// Wheel scrolled flag
	private boolean wheelScrolled = false;

	// Wheel changed listener
	private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
		public void onChanged(WheelView wheel, int oldValue, int newValue) {
			if (!wheelScrolled) {
				updateStatus();
			}
		}
	};

	// Wheel scrolled listener
	OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
		public void onScrollingStarted(WheelView wheel) {
			wheelScrolled = true;
		}

		public void onScrollingFinished(WheelView wheel) {
			wheelScrolled = false;
			updateStatus();
		}
	};

	/**
	 * Updates entered PIN status
	 */
	private void updateStatus() {

		expectSelected = ExpectListInfo.getExpectListInfo().getExpectList().get(mWheelView.getCurrentItem() + 1);
		// Toast.makeText(LotteryInfoListAgp.this, "" +
		// ExpectListInfo.getExpectListInfo().getExpectList().get(mWheelView.getCurrentItem()
		// + 1), Toast.LENGTH_SHORT).show();

	}

	/**
	 * @Title: jumpToCurrentInfo
	 * @Description: 跳转到本期开奖信息页面
	 * @param: @param msg 设定文件
	 * @return: void 返回类型
	 * @throws
	 */
	public void jumpToCurrentInfo(Message msg) {
		Intent intent = new Intent();
		intent.setClass(LotteryInfoListAgp.this, LatestdetailsAct.class);
		lllatestdetails.setBackgroundResource(R.drawable.anull_icon);
		llmoretime.setBackgroundResource(R.drawable.btn_default_title_right_88x30);
		ivlatestdetails.setImageResource(R.drawable.icon_pressed_this_13x23);
		ivmoretime.setImageResource(R.drawable.icon_default_all_24x24);
		tvlatestdetails.setTextColor(getResources().getColor(R.color.white));
		tvmoretime.setTextColor(getResources().getColor(R.color.lotteryinfodefault));
		container.removeAllViews();
		container.addView(getLocalActivityManager().startActivity(Key.KEY_LATESTDETAILS, intent).getDecorView());
		LatestdetailsAct.handlerLatestsetailsAct.sendMessage(msg);
		String expect = msg.getData().getString(Key.KEY_EXPECT);
		if (expect.equals(CurrentLotteryNumInfo.getCurrentLotteryNumInfo().getLastexpect())) {
			tvlatestdetails.setText(Language.TEXT_LATEST_DETIAL_LOTTERY);
		} else {
			tvlatestdetails.setText(Language.TEXT_DETIAL_LOTTERY);
		}
	}

}
